<%--
  Created by IntelliJ IDEA.
  User: carlst6
  Date: 2/21/12
  Time: 12:59 PM
  To change this template use File | Settings | File Templates.
--%>

<%@ page import="bidsanity.Customer; bidsanity.Bid; bidsanity.Listing" contentType="text/html;charset=UTF-8" %>
<html>
<head>
  <meta name="layout" content="main"/>
  <title> - Customer Details</title>
</head>
<body>
<h1>User: ${customer.getNameFromEMail().encodeAsHTML()}</h1>
<g:if test="${flash.message}">
    <p class="message">${flash.message}</p>
</g:if>
<div>Email Address: ${customer.emailAddress.encodeAsHTML()}</div>
<div>Listings Sold/Selling: ${Listing.findAllBySeller(customer).size()}</div>
<div>Bids Placed: ${Bid.findAllByBidder(customer).size()}</div>
<p></p>
<g:if test="${session.user && (Customer.findByEmailAddress(session.user).isAdmin || Customer.findByEmailAddress(session.user).id == customer.id)}">
    <span><g:link controller="Customer" action="edit" id="${customer.id}">Edit / Delete</g:link> </span>
</g:if>
%{--<g:form action="delete" method="post">--}%
%{--<g:hiddenField name="id" value="${customer?.id}" />--}%
%{--<g:submitButton name="delete" id="submitButton" value="Delete Account" onclick="return confirm('Are you sure?');"/>--}%
%{--</g:form>--}%
</body>
</html>